$(function(){
    var cs = getQueryString(href).brandtitleid;
    console.log(cs)
    let product = document.querySelector("#product>.ulbox")
    let str = ""
    fetch(`http://chst.vip:1234/api/getbrandproductlist?brandtitleid=${cs}`)
    .then(body=>body.json())
    .then(res=>{
        console.log(res.result);
        res.result.forEach(item => {
            let regExp = /(\/|http)[^>]+\.(jpg|jpeg|png|gif)/g
            let r = item.productImg.match(regExp)
            console.log(r);
            str += 
            `
            <li productid=${item.productId}>
                <a href="#" >
                    <div class="img"><img src="${r[0]}" alt=""></div>
                    <div class="info">
                        <div class="title">
                            <h4>${item.productName}</h4>
                            <div class="price">${item.productPrice}</div>
                        </div>
                        <div class="other">
                            <span>${item.productQuote}</span>  
                            <i class="iconfont icon-pinglun">${item.productCom}</i>                      
                        </div>
                    </div>
                </a>
            </li>
            `
    });
        product.innerHTML=str;

        let uli = document.querySelectorAll("li")
            console.log(uli);
            for(var i=0;i<uli.length;i++){
                uli[i].onclick=function(){
                let id = this.getAttribute('productid')
                console.log(id)
                location.href='./branddetail.html?productid='+id
                }
            }

    })
})